*********************************************************************************
*                                                                               *
*                Election Frequency - Preparing the Dataset     	            *
*                                                                               *
*                         		  Analysis                                      *
*                                                                               *
*********************************************************************************
 
global beg_path `"C:\Users\JohnSmith\Dropbox\Replication_EF\"'  // F - Home
 
cd `"${beg_path}Data\Analysis 1\"'
use electionsdata_4.dta, clear

*Elections analyzed
list Country Year if Rankleg!=.

gen Majority = abs(50-First)
lab var  Majority  "Majority Status"
gen Closeness = First-Second
lab var Closeness "Closeness"

gen Decade_1930 = Year > 1929 & Year < 1940 
gen Decade_1940 = Year > 1939 & Year < 1950 
gen Decade_1950 = Year > 1949 & Year < 1960 
gen Decade_1960 = Year > 1959 & Year < 1970 
gen Decade_1970 = Year > 1969 & Year < 1980 
gen Decade_1980 = Year > 1979 & Year < 1990 
gen Decade_1990 = Year > 1989 & Year < 2000 
gen Decade_2000 = Year > 1999 & Year < 2010 
gen Decade_2010 = Year > 2009 & Year < 2020 

lab var Decade_1930 "1930s"
lab var Decade_1940 "1940s"
lab var Decade_1950 "1950s"
lab var Decade_1960 "1960s"
lab var Decade_1970 "1970s"
lab var Decade_1980 "1980s"
lab var Decade_1990 "1990s"
lab var Decade_2000 "2000s"
lab var Decade_2010 "2010s"

gen CV = 0
replace CV = 1 if (Country == 9 & Year<= 1967 & Type==2) | (Country == 5 & Year<=2000 & Type==2)

lab var index_nofel_0_5  "Number of Elections: 0.5 years"
lab var index_nofel_1  "Number of Elections: 0.5 - 1 years"


*Leg. election rank after democratization (dummies)
tab Rankleg, gen(Rankleg) 

*Regional dummies 
gen region = .
replace region =1 if inlist(Country, 1, 3, 4, 6, 7, 8, 9, 10, 12)
replace region =2 if inlist(Country, 2, 5, 11) 
replace region =3 if Country > 20
label define region 1"Western Europe" 2"Southern Europe" 3"Postcommunist Europe" 
label values region region
fre region


*** Variable Decades 
recode Year (1930/1939 = 1930 "1930s") (1940/1949 = 1940 "1940s") (1950/1959 = 1950 "1950s") (1960/1969 = 1960 "1960s") (1970/1979= 1970 "1970s") (1980/1989=1980 "1980s") (1990/1999=1990 "1990s") ///
(2000/2009 = 2000 "2000s") (2010/2019 = 2010 "2010s"), gen(decade)

 
* Information about Maximal and Minimal Values on the Index of Election Frequency
su index_n_w_5
list Country Year if index_n_w_5 == r(min)
list Country Year if index_n_w_5 == r(max)
tabstat index_n_w_5 if Country<20, by(decade) // .4461522 = between the 1970s and 2010s
*France 
tabstat index_n_w_5 if Country==4, by(decade) // 1.7265675 = increase between the 1970s and 2010s
*Greece 
tabstat index_n_w_5 if Country==5, by(decade) // 1.12 = increase between the 1970s and 2010s


*** Figure First Analysis 

*For results 
gen num_of_elections_5 = index_nofel_5 + index_nofel_4 + index_nofel_3 + index_nofel_2 + index_nofel_1 + index_nofel_0_5 + index_nofel_0_35d 
pwcorr num_of_elections_5  Turnout // => - 0.593
sort Country Year

cap set scheme bw // Setting the scheme, not necessary for running the script
 
*Figure 1
local l = 1/365.25
tw function y=1/exp(x), range(`l' 5) || function y=0.75/exp(x), range(`l' 5)  || function y=0.50/exp(x), range(`l' 5)  ///
|| function y=0.25/exp(x), range(`l' 5)   xtitle("Distance in Years (from election {it:i} for which the index is calculated)", margin(medsmall)) ytitle("Contribution to the Index for Past Election {it:j}") scale(0.8)  ylabel(0(.2)1) ///
legend(row(4) lab(1 "Eligible voters = the whole electorate") lab(2 "Eligible voters = 75 % of the electorate")  lab(3 "Eligible voters = 50 % of the electorate")  lab(4 "Eligible voters = 25 % of the electorate") size(small) bplace(1) ring(0))  title("")  name(graph1, replace) xlabel(,grid)

cd `"${beg_path}Results"'
graph export "Figure_1.eps", replace  // width(3000) 

*Figure 2

tw connected Turnout Year if Rankleg !=. || connected num_of_elections_5 Year if Rankleg !=., yaxis(2) by(Country, note("") r1title("Number of elections", size(medsmall)) legend(position(0)))  ///
legen(lab(1 "Voter Turnout") lab(2 "Number of Elections (last 5 years)") size(vsmall) row(2)) xtitle("") ytitle("Turnout") /// 
ytitle("Number of Elections", axis(2)) xlab(, grid) // the position of the legend has to be adjusted manually using the Graph editor!
 
graph export "Figure_2.eps", replace  // 

*** Main Analysis 

xtset Country Rankleg 
eststo clear 
gen Year_since_1945=Year-1945

 
eststo M1: xtpcse Turnout i.snap c.Year_since_1945 i.Country  if Rankleg !=. & Majority!=. & Elsystem!=. & Closeness!=. & CV!=.  & Joint1!=., correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "No" , replace 
estadd local year "Yes" , replace 
estadd local controls "No" , replace 

eststo M2: xtpcse Turnout index_nofel_0_35d index_nofel_0_5 ///
index_nofel_1_2 index_nofel_3_4  index_nofel_5  c.Year_since_1945 i.Country  if Rankleg !=. & Majority!=. & Elsystem!=. & Closeness!=. & CV!=.  & Joint1!=., correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "No" , replace 
estadd local year "Yes" , replace 
estadd local controls "No" , replace 

eststo M3: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#i.Country i.Country index_nofel_0_35d  index_nofel_0_5 ///
 index_nofel_1_2 index_nofel_3_4  index_nofel_5  if Rankleg !=., correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

eststo M4: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#i.Country i.Country index_n_w_5  if Rankleg !=., correlation(ar1) 
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

eststo M5: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#i.Country i.Country  index_n_w_5 index_nofel_0_35d index_nofel_0_5 ///
index_nofel_1_2 index_nofel_3_4  index_nofel_5 i.snap if Rankleg !=., correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

eststo M6: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#i.Country i.Country index_w_5   if Rankleg !=., correlation(ar1) 
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

eststo M7: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#i.Country i.Country index_w_5b if Rankleg !=., correlation(ar1) 
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace

eststo M8: xtpcse Turnout Majority Closeness  i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country i.Country index_n_w_FOE_5 index_n_w_SOE_5 if Rankleg !=., correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

eststo M9: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 i.Country c.Year_since_1945#i.Country i.Country index_n_w_national_5 index_n_w_referendum_5	index_n_w_supranational_5 index_n_w_subnational_5 , correlation(ar1)  
estadd local fixed "Yes" , replace 
estadd local country_year "Yes" , replace 
estadd local year "No" , replace 
estadd local controls "Yes" , replace 

*None of these differences is statistically significant
test index_n_w_national_5 = index_n_w_referendum_5
test index_n_w_referendum_5 = index_n_w_supranational_5 
test index_n_w_referendum_5 = index_n_w_subnational_5
 
*************** 
*** Table 1 *** 
***************
 
esttab  M1 M2 M3 M4 M5 M6 M7 M8 M9 using Table_1.tex, one incelldelimite("\:")  stats(controls  year country_year fixed N r2, labels("Controls" "Time Trend" "Country-Specific Time Trend" "Country FE"  "N" "R2") layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}"  "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" )  fmt(0 0 0 0 0 3)) replace b(2) se(2) wide staraux ///
		star(* 0.05 ** 0.01 *** 0.001) eqlabels(none) order(1.snap index_nofel_0_35d index_nofel_0_5 index_nofel_1_2 index_nofel_3_4 index_nofel_5 index_n_w_5 index_w_5 index_w_5b  index_n_w_FOE_5 index_n_w_SOE_5  ///
		index_n_w_national_5 index_n_w_referendum_5	index_n_w_supranational_5 index_n_w_subnational_5 ) ///
		drop(*.Country* Majority Closeness *.Elsystem *.CV 1.Joint1 0.Joint1 Year_since_1945 0.snap) varlabels(index_nofel_0_5 "Number of Elections: 0.1-0.5 years" 1.snap "Snap Election" _cons "Constant",  elist(Year \hline ))   label /// 
		nodep  ///  
		nolegend note("") alignment(d{10})  nomtitles // 
	
*** Full Table 1 for the Appendix (Table A2)
esttab M1 M2 M3 M4 M5 M6 M7 M8 M9 using A_Table_2.tex, one incelldelimite("\:")  stats(year country_year fixed N r2, labels("Time Trend" "Country-Specific Time Trend" "Country FE"  "N" "R2") layout("\multicolumn{1}{c}{@}" /// 
"\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{$@$}" "\multicolumn{1}{c}{$@$}")  ///
fmt(0 0 0 0 2)) replace b(2) se(2) wide staraux ///
		star(* 0.05 ** 0.01 *** 0.001) eqlabels(none) order(Majority Closeness *.Elsystem 1.CV 1.Joint1 1.snap index_nofel_0_35d index_nofel_0_5 index_nofel_1_2 index_nofel_3_4 index_nofel_5 index_n_w_5 index_w_5 index_w_5b  index_n_w_FOE_5 index_n_w_SOE_5  ///
		index_n_w_national_5 index_n_w_referendum_5	index_n_w_supranational_5 index_n_w_subnational_5  ) ///
		drop(*.Country* Year_since_1945 ) varlabels(1.snap "Snap Election" index_nofel_0_5 "Number of Elections: 0.1-0.5 years"  1.Joint1 "Concurrent Elections" /// 
		1.CV "Compulsory Voting" _cons "Constant",  )   label ///  
 nodep  nobase refcat(Majority "\textit{Controls:}" index_nofel_0_35d "\textit{Election Frequency:}", nolabel) ///   
		nolegend note("") alignment(d{10})  nomtitles // 
	
 
 
**************** 
*** Table A3 *** 
****************
 
eststo clear 
eststo M1: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country i.Country  index_n_w_5 GDP_pc c.GDP_pc#c.GDP_pc if Rankleg !=.,  correlation(ar1)  // GDP
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace 

eststo M2: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country i.Country index_n_w_5 rile economic_axis cultural_axis if Rankleg !=.,  correlation(ar1)  // Polarisation
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace 
eststo M3: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country ib4.Country index_n_w_5  if Rankleg !=. & Year < 1990,  correlation(ar1) pairwise // Year smaller than 1990
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M4: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country ib4.Country index_n_w_5  if Rankleg !=. & Year > 1989,  correlation(ar1) pairwise  // Year larger than 1980
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M5: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country  ib4.Country index_n_w_5  if Rankleg !=. & Rankleg > 5,  correlation(psar1)  pairwise // Consolidated dem.
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M6: xtreg Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country  index_n_w_5 if Rankleg !=.,  fe cluster(Country)   // FE & Clustered standard errors
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M7: xtreg Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945 c.Year_since_1945#c.Year_since_1945 index_n_w_5 GDP_pc c.GDP_pc#c.GDP_pc if Rankleg !=., re cluster(Country) // RE 
estadd local fixed "No" , replace 
estadd local country_year_2 "No" , replace
estadd scalar r2 =e(r2_o)
eststo M8: reg d.Turnout d.Majority d.Closeness d.Elsystem d.CV d.Joint1 d.index_n_w_5 if Rankleg !=., cluster(Country) // First Differenced Model
estadd local fixed "No" , replace 
estadd local country_year_2 "No" , replace
eststo M9: xtpcse Turnout Majority Closeness i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country  ib4.Country  index_n_w_5  if Rankleg !=. & filter_coverage==0,  correlation(ar1) pairwise  // With filter for pop coverage
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M10: xtpcse Turnout  i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country ib4.Country  index_n_w_5  if Rankleg !=.,  correlation(ar1) pairwise  // No closeness & decisiveness 
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace
eststo M11: xtpcse Turnout  i.Elsystem i.CV i.Joint1 c.Year_since_1945  c.Year_since_1945#i.Country ib4.Country i.snap index_n_w_5  if Rankleg !=.,  correlation(ar1) pairwise  // Snap
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace


esttab M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 using A_Table_3.tex, one incelldelimite("\:")  stats(fixed country_year_2 N r2, labels("Country FE" "Country-Specific Time Trend" "N" "R2") layout("\multicolumn{1}{c}{@}" ///
"\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{$@$}" "\multicolumn{1}{c}{$@$}")   fmt(0 0 2)) replace b(2) se(2) wide staraux ///
		star(* 0.05 ** 0.01 *** 0.001) eqlabels(none) order(Majority Closeness 2.Elsystem 3.Elsystem 1.CV 1.Joint1  Year_since_1945 c.Year_since_1945#c.Year_since_1945  GDP_pc c.GDP_pc#c.GDP_pc rile economic_axis cultural_axis D.Majority /// 
		D.Closeness D.Elsystem D.CV D.Joint1 index_n_w_5 D.index_n_w_5 1.snap) ///
		drop(*.Country* 1.Elsystem 0.CV 0.Joint1 0.snap) varlabels( 2.Elsystem  "El. System: Proportional" 3.Elsystem "El. System: Mixed" ///
		Year_since_1945 "Year" c.Year_since_1945#c.Year_since_1945 "Year^2" 1.CV "Compulsory Voting" 1.Joint1 ///
		"Concurrent Elections" _cons "Constant" 1.snap "Snap Election" ///
		d.Majority "Majority Status(FT)" d.Closeness "Closeness (FD)" d.Elsystem "El. System (FD)" d.CV "Compulsory Voting (FD)" d.Joint1 "Concurrent Elections (FD)" ///
		d.index_n_w_5,  elist(d.CV   \hline ))   label /// 
		nodep refcat(Majority "\textit{Controls:}"  index_n_w_5  "\textit{Election Frequency:}", nolabel) ///    
		  nolegend note("") ///
		mtitles("\shortstack{\\GDP p/c}" "\shortstack{\\ Polarisation\\(Manifesto Project)}" "\shortstack{\\Period before 1990}" ///
		"\shortstack{\\Period from 1990}" "\shortstack{\\Consolidated Democracy\\(6th and later dem. el.)}" ///
		"\shortstack{\\FE \& clustered SE \\by country}"  "\shortstack{\\RE \& clustered SE \\by country}" ///
		"\shortstack{\\FD Model}" "\shortstack{\\Filter for\\extrap. coverage}" "\shortstack{\\No post-treatment\\controls}" ///
		"\shortstack{\\Snap \\ Elections}" ) alignment(d{10})
		
		
*** Robustness Checks 2 (Leaving One Country At a Time) 

********************* 
*** Table A4 & A5 *** 
*********************

fvset base 4 Country // Settin a common base-line for the following models

eststo clear
foreach i  of numlist 1 2 3 4 5 6 7 8 9 10 11 12 21 22 23 24 25 26 27 28 29 30 {
eststo M`i': xtpcse Turnout Majority Closeness ib1.Elsystem i.CV i.Joint1 c.Year  c.Year_since_1945#i.Country i.Country index_n_w_5 if Rankleg !=. & Country!=`i',  correlation(ar1) 
estadd local fixed "Yes" , replace 
estadd local country_year_2 "Yes" , replace 
estadd local year "Yes" , replace 
}


esttab M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 using A_Table_4.tex, one incelldelimite("\:")  stats(year country_year_2 fixed N r2, ///
 labels("Time Trend" "Country-Specific Time Trend" "Country FE" "N" "R2") layout("\multicolumn{1}{c}{@}" ///
"\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{$@$}" "\multicolumn{1}{c}{$@$}")  fmt(0 0 2)) replace b(2) ///
 se(2) wide staraux ///
		star(* 0.05 ** 0.01 *** 0.001) eqlabels(none) order(Majority Closeness *.Elsystem *.CV 1.Joint1 Year  index_n_w_5) ///
		drop(*.Country* 1.Elsystem 0.CV 0.Joint1) varlabels( 2.Elsystem  "El. System: Proportional" 3.Elsystem  "El. System: Mixed " c.Year#c.Year "Year^2" 1.CV "Compulsory Voting" 1.Joint1 ///
		"Concurrent Elections" _cons "Constant",  )   label /// elist(c.Year#c.Year   \hline )
		nodep refcat(Majority "\textit{Controls:}"  index_n_w_5  "\textit{Election Frequency:}", nolabel) ///   nobase
		nonumbers nolegend note("") ///
		mtitles("\shortstack{\\Without\\Denmark}" "\shortstack{\\Without\\Spain}"  "\shortstack{\\Without\\Finland}"  "\shortstack{\\Without\\France}"  "\shortstack{\\Without\\Greece}"  "\shortstack{\\Without\\Ireland}" ///
		"\shortstack{\\Without\\Iceland}" "\shortstack{\\Without\\Malta}" "\shortstack{\\Without\\Netherlands}"  "\shortstack{\\Without\\Norway}"  "\shortstack{\\Without\\Portugal}"  "\shortstack{\\Without\\Sweden}") ///
		alignment(d{10})

esttab M21 M22 M23 M24 M25 M26 M27 M28 M29 M30 using A_Table_5.tex, one incelldelimite("\:")  stats(year country_year_2 fixed N r2, ///
 labels("Time Trend" "Country-Specific Time Trend" "Country FE" "N" "R2") layout("\multicolumn{1}{c}{@}" ///
"\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{$@$}" "\multicolumn{1}{c}{$@$}")  fmt(0 0 2))  replace b(2) se(2) wide staraux ///
		star(* 0.05 ** 0.01 *** 0.001) eqlabels(none) order(Majority Closeness *.Elsystem *.CV 1.Joint1  Year index_n_w_5) ///
		drop(*.Country* 1.Elsystem 0.CV 0.Joint1) varlabels( 2.Elsystem  "El. System: Proportional" 3.Elsystem  "El. System: Mixed " c.Year#c.Year "Year^2" 1.CV "Compulsory Voting" 1.Joint1 ///
		"Concurrent Elections" _cons "Constant", ) label ///  
		nodep refcat(Majority "\textit{Controls:}"  index_n_w_5  "\textit{Election Frequency:}", nolabel) ///    
		nonumbers nolegend note("") ///
		mtitles("\shortstack{\\Without\\Bulgaria}" "\shortstack{\\Without\\Czech Rep.}"  "\shortstack{\\Without\\Estonia}"  "\shortstack{\\Without\\Hungary}"  "\shortstack{\\Without\\Latvia}"  "\shortstack{\\Without\\Lithuania}" ///
		"\shortstack{\\Without\\Poland}" "\shortstack{\\Without\\Romania}"  "\shortstack{\\Without\\Slovakia}"  "\shortstack{\\Without\\Slovenia}") ///
		alignment(d{10})
 

***** Diagnostics 
tsset Country Rankleg
tab Country, gen(country)
tab Elsystem, gen(elsys)
foreach lname in country1 country2 country3 country4 country5 country6 country7 country8 country9 country10 country11 country12 country13 country14 country15 ///
country16 country17 country18 country19 country20 country21 country22 {
gen Year_`lname' = `lname' * Year 
}
 

xtreg Turnout Majority Closeness elsys* CV Joint1 Year index_n_w_5 if Rankleg !=. , fe 
estimates store fixed
xtreg Turnout Majority Closeness elsys* CV Joint1 Year  index_n_w_5 if Rankleg !=. , re 
estimates store random
hausman fixed random , sigmamore


* Tests for autocorrelation  (the null hypothesis is that there is no correlation)
cap net install st0039
xtserial Turnout Majority Closeness elsys* CV Year Year_* country* index_n_w_5 if Rankleg !=. // p = 0.0448  
		
******* Tests non-stationarity (the null hypothesis = all panels contain unit roots, are not stationary), p values:  
xtunitroot fisher Turnout if Rankleg !=., pperron lags(1)  
xtunitroot fisher Turnout if Rankleg !=. , pperron lags(2)  
xtunitroot fisher Turnout if Rankleg !=., pperron lags(3)  

***********Tests for contemporaneous correlation (the null hypothesis is no contemporaneous correlation) 
xtreg Turnout Majority Closeness elsys* CV Joint1 Year Year_* index_n_w_5 if Rankleg !=. , fe 
xtcsd, pesaran //Pr = 0.0017


****Descriptive statistics***

	tabstat Turnout Year Majority Closeness elsys1 elsys2 elsys3 CV Joint1 snap index_nofel_0_35d index_nofel_0_5 index_nofel_1_2 index_nofel_3_4 index_nofel_5 index_n_w_5 index_w_5 index_w_5b  index_n_w_FOE_5  /// 
	index_n_w_SOE_5 index_n_w_national_5 index_n_w_referendum_5	index_n_w_supranational_5 index_n_w_subnational_5  ///
	if Rankleg !=.& Closeness!=., stat(count mean sd min max ) c(s) format(%9.2f)  	 
	
	* For export
	lab var Joint1 "Concurrent Elections"
	lab var elsys1 "Majoritarian"
	lab var elsys2 "Proportional"
	lab var elsys3 "Mixed"
	
	
****************
*** Table A1 *** 
****************
	
	sutex2 Turnout Year Majority Closeness elsys1 elsys2 elsys3 CV Joint1 snap index_nofel_0_35d index_nofel_0_5 index_nofel_1_2 index_nofel_3_4 index_nofel_5 index_n_w_5 index_w_5 index_w_5b   index_n_w_FOE_5  /// 
	index_n_w_SOE_5 index_n_w_national_5 index_n_w_referendum_5	index_n_w_supranational_5 index_n_w_subnational_5  if Rankleg !=.& Closeness!=., varlab tabular minmax saving(A_Table_1.tex) replace digits(2)  
 
		

